package com.movw.controller;

import com.movw.beans.News;
import com.movw.beans.News_category;
import com.movw.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class JsonData {
    @Autowired
    private AdminService adminService;

    @RequestMapping("/newslist")
    @ResponseBody
    public List<News> getNewsTitle() {
        List<News> newslist = adminService.selectNews();
        return newslist;
    }
    @RequestMapping("/news_category")
    @ResponseBody
    public List<News_category> getNews_category() {
        List<News_category> newslist = adminService.selectUser_category();
        return newslist;
    }
}
